package com.ruiyi.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

//该类是用来存储方法返回的结果
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result {

    //code 状态码 200 成功  -1 请求失败
    private Integer code = 200;

    //显示错误信息
    private String msg;

    //保存数据
    private Object data;

    //分页
    private Long total = 0L;

    //前端传参出错
    public static final Result DATA_FORMAT_ERROR = new Result(-1,"前端传递的参数格式错误");

    //后端代码报错
    public Result(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

}
